import request from '@/utils/request'

// 查询热搜主题AI生成文本列表
export function listDigest(query) {
  return request({
    url: '/digest/digest/list',
    method: 'get',
    params: query
  })
}

// 查询热搜主题AI生成文本详细
export function getDigest(id) {
  return request({
    url: '/digest/digest/' + id,
    method: 'get'
  })
}

// 新增热搜主题AI生成文本
export function addDigest(data) {
  return request({
    url: '/digest/digest',
    method: 'post',
    data: data
  })
}

// 修改热搜主题AI生成文本
export function updateDigest(data) {
  return request({
    url: '/digest/digest',
    method: 'put',
    data: data
  })
}

// 删除热搜主题AI生成文本
export function delDigest(id) {
  return request({
    url: '/digest/digest/' + id,
    method: 'delete'
  })
}

// AI自动分析所有未处理的主题
export function autoAnalyzeAllTopics() {
  return request({
    url: '/digest/digest/ai/auto-analyze',
    method: 'post'
  })
}

// 获取AI分析进度
export function getAnalysisProgress(taskId) {
  return request({
    url: `/digest/digest/ai/progress/${taskId}`,
    method: 'get'
  })
}

// 停止AI分析任务
export function stopAnalysisTask(taskId) {
  return request({
    url: `/digest/digest/ai/stopAnalysis`,
    method: 'post',
    params: { taskId }
  })
}